package br.edu.utfpr.md.client;

import java.rmi.Naming;

import br.edu.utfpr.md.beans.Livro;
import br.edu.utfpr.md.interfaces.ICarrinho;
import br.edu.utfpr.md.interfaces.ICarrinhoFactory;

public class ClienteLojaCarrinhos {
	public static void main(String[] args) throws Exception {
		ICarrinhoFactory factory = (ICarrinhoFactory) Naming.lookup("rmi://localhost:1099/loja/carrinhos");
		ICarrinho carrinho = factory.create();
		
		Livro l1 = new Livro();
		l1.setNome("OO com Java");
		l1.setPreco(40);
		Livro l2 = new Livro();
		l2.setNome("Java na Web");
		l2.setPreco(50);
		
		carrinho.addLivro(l1);
		carrinho.addLivro(l2);
		
		System.out.println(carrinho.getTotal());
	}
}
